<?php

    $servername = "localhost";
    $username = "root";
    $password = "root23";


//    建立数据库
    try{
        $conn = new mysqli($servername, $username, $password);
    }
        catch(Exception $e){
            die("连接失败：".$e->getMessage());
        }
        if ($conn->connect_error){
            die("连接失败：".$conn->connect_error);
        }


    $sql = "CREATE DATABASE IF NOT EXISTS OOPDB";
    if ($conn->query($sql) === TRUE) {
        echo "数据库创建成功！",PHP_EOL;
    } else{
        echo "数据库创建失败：".$conn->error;
    }

    $conn->close();

?>


